/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package verins.DAO;

import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.persistence.Query;
/**
 *
 * @author hectdx
 */
public class TipoPersonaDAO {

    
    public List findAll(){
        List lista=null;
        
        try{
           
            EntityManagerFactory emf = Persistence.createEntityManagerFactory("verinsPU");
            EntityManager em = emf.createEntityManager();
            Query query=em.createNamedQuery("Tipopersona.findAll");

            lista=query.getResultList();
            if(em.getTransaction().isActive())
                em.getTransaction().commit();
            em.close();
            emf.close();

            return lista;
            
        }catch(Exception ex){
            System.out.println(lista!=null?lista.size():"-");
        }
        return lista;
    }
    
   


}
